
// LoginDlg.h : header file
//
#define PORT 27000
#define WM_SOCKET WM_USER+2
#include "GlobalSocket.h"
#pragma once


// CLoginDlg dialog
class CLoginDlg : public CDialog
{
// Construction
public:
	CLoginDlg(CWnd* pParent = NULL);	// standard constructor

// Dialog Data
	enum { IDD = IDD_LOGIN_DIALOG };

	protected:
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support

//**************************************<<
	bool m_visible;
	int sendType;
	CString sUsername;//username
	CString sReceivedMessage;//message nhan duoc
	int buffLength; //chieu dai message nhan
	SOCKET sClient; 
	int WMSOCKET;
	bool isConnected;
	CGlobalSocket *globalSock;//
	LRESULT SockMsg(WPARAM wParam,LPARAM lParam);
	LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
	BOOL PreTranslateMessage(MSG* pMsg);
	int sendPackage(CString Package);
	int createPackage(int type);
	
//**************************************>>
// Implementation
protected:
	HICON m_hIcon;

	// Generated message map functions
	virtual BOOL OnInitDialog();
	afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
	afx_msg void OnPaint();
	afx_msg HCURSOR OnQueryDragIcon();
	afx_msg void  OnWindowPosChanging(WINDOWPOS *lpwndpos);
	DECLARE_MESSAGE_MAP()
public:
	afx_msg void OnBnClickedBtnLogin();
	afx_msg void OnBnClickedCancel();
};
